package com.javaapi.jsoup;

import java.io.File;
import java.io.IOException;

import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;

public class HtmlExample {

	/**
	 * @throws IOException
	 * @Title: main
	 * @Description: TODO(这里用一句话描述这个方法的作用)
	 * @param @param args 设定文件
	 * @return void 返回类型
	 * @throws
	 */

	public static void main(String[] args) throws IOException {
		File input = new File("D:\\test.html");
		Document doc;
		doc = Jsoup.parse(input, "UTF-8", "http://example.com/");
		Element content = doc.getElementById("content");
		Elements links = content.getElementsByTag("a");

		for (Element link : links) {
			String linkHref = link.attr("href");
			String linkText = link.text();
		}
	}
}
